package com.owg.jigsaw.test;

import java.awt.Component;
import java.awt.Frame;
import java.awt.Label;
import java.awt.Panel;
import java.util.Arrays;

import com.owg.jigsaw.WBlock;
import com.owg.jigsaw.WRoot;
import com.owg.jigsaw.blocktypes.WHPanelBlock;
import com.owg.jigsaw.blocktypes.WLabelBlock;
import com.owg.jigsaw.blocktypes.WVPanelBlock;
import com.owg.jigsaw.blocktypes.WindowBlock;
import com.owg.jigsaw.hierarchy.TypeHierarchy;
import com.owg.jigsaw.javafx.fxml.FXPalette;

import javafx.fxml.FXML;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class WindowBuilderController
{	
	@FXML
	FXPalette palette1;
	@FXML
	FXPalette palette2;
	
	public void start(Stage stage, Parent ui)
	{
		WRoot wroot = new WRoot(new TypeHierarchy(Frame.class, Component.class, Panel.class, Label.class));
		palette1.setPalette(wroot, Arrays.asList(
			new WindowBlock(wroot, true), 
			new WLabelBlock(wroot, true, "Label")
		));
		wroot.installContentPane(ui);
		Scene scene = new Scene(wroot.getUI(), 960, 640);
		
		stage.setTitle("WindowBuilder (FXML)");
		stage.setScene(scene);
		stage.show();
		
		palette2.setPalette(wroot, Arrays.asList(new WBlock[]{ 
			new WHPanelBlock(wroot, true), 
			new WVPanelBlock(wroot, true)
			}));
	}
}
